<template>
  <div>
    <CompDemo title="Hello World" :userInfo="userInfo" />
    <my-comp @confirm="onConfirmHandler" title="也是一个组件Demo" :userInfo="{ name: '小紫', age: 20 }" />
  </div>
</template>

<script>
import Vue from 'vue';
import CompDemo from '@/components/CompDemo.vue';

Vue.component('my-comp', CompDemo);

export default {
  name: 'ComponentDemo',
  components: {
    CompDemo,
  },
  data() {
    return {
      userInfo: {
        name: '小王',
        age: 18,
      },
    };
  },
  methods: {
    onConfirmHandler(info) {
      console.log('确认了用户信息', info);
    },
  },
}
</script>

<style>

</style>